var t = function (t) {
  return t && t.__esModule ? t : {
    default: t
  };
}(),
  e = getApp(),
  a = 0;

Page({
  data: {
    prenumber: 10,
    url: "patient/mycommunity/list/",
    curHdIndex: 1,
    communityListOne: [],
    pageOne: 0,
    moreBooOne: !0,
    loadingBoo: !0,
    oneBoo: !1,
    mask: !0,
    communityListOne: [],
    currindex: 0,
  },
  addCommunity: function () {
    wx.navigateTo({
      url: "/hyb_yl/userLife/pages/addDynamic/addDynamic"
    });
  },
  bindscroll: function (t) {
    t.detail.scrollTop > this.data.windowHeight ? this.setData({
      topFlag: !0
    }) : this.setData({
      topFlag: !1
    });
  },
  toTop: function (t) {
    this.setData({
      topFlag: !1,
      scrollTop: 0
    });
  },
  moreState: function () {
    var e = this,
      a = {},
      n = e.data.prenumber + "/" + e.data.token;
    // t.default.getCommunityList(e, a, n);
  },
  toLike: function (e) {
    var a = this,
      n = e.currentTarget.dataset.index,
      i = e.currentTarget.dataset.status;
    1 != i ? a.data.currindex != n || 1 == i ? (a.setData({
      currindex: n
    }), t.default.toLike(a, e, 1)) : wx.showToast({
      title: "【点赞】是严肃的，不可以反悔哦！",
      icon: "none",
      duration: 2e3
    }) : wx.showToast({
      title: "【点赞】是严肃的，不可以反悔哦！",
      icon: "none",
      duration: 1500
    });
  },
  // previewImageOne: function (t) {
  //   a = 0;
  //   var n = [],
  //     i = this.data.communityListOne,
  //     o = t.target.dataset.imgindex,
  //     r = t.currentTarget.dataset.tid;
  //   i && i.forEach(function (t) {
  //     if (t.tid == r) return n = t.estimateTcontentImgBig, !1;
  //   }), e.previewImage(t, n, o);
  // },
  // previewImageTwo: function (t) {
  //   a = 0;
  //   var n = [],
  //     i = this.data.communityListOne,
  //     o = t.target.dataset.imgindex,
  //     r = t.currentTarget.dataset.tid;
  //   i && i.forEach(function (t) {
  //     if (t.tid == r) return n = t.patientBbsReplyVO.estimatePicBigUrl, !1;
  //   }), e.previewImage(t, n, o);
  // },
  previewImage: function(a) {
    var t = this;
    console.log(a)
    var i = a.currentTarget.dataset.index;
    var url = a.currentTarget.dataset.url
    var artrs = a.currentTarget.dataset.data
    console.log(i, url, artrs)
    wx.previewImage({
      current: url,
      urls: artrs
    });
  },
  toLike: function (e) {
    var a = this,
      i = e.currentTarget.dataset.index,
      o = e.currentTarget.dataset.status;
    let dianj = e.currentTarget.dataset.status;
    var a_id = a.data.a_id
    if (dianj == 0) {
      app.util.request({
        'url': 'entry/wxapp/share.userdianz',
        data: {
          op: 'dianzan',
          parentid: a_id,
          openid: wx.getStorageSync('openid'),
        },
        success: function (res) {
          console.log(res)
          a.setData({
            dianj: 1
          })
        }
      })
    } else {
      wx.showToast({
        title: "点赞是严肃的，不可以反悔哦！",
        icon: "none",
        duration: 1500
      });
    }
  },
  goComment: function (e) {
    console.log(e)
    var that = this
    var a_id = that.data.a_id
    var t = that.data.comFlag;
    that.setData({
      comFlag: !t,
      a_id: a_id
    });
  },
  onLoad: function (t) {
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    this.getAllmyshare()
  },
  onReady: function () {
   
  },
  onShow: function () {
    this.getAllmyshare()
  },
  onHide: function () {
    1 == a && this.setData({
      communityListOne: []
    }), a = 1;
  },
  getAllmyshare: function () {
    var that = this
    e.util.request({
      'url': 'entry/wxapp/share.myshare',
      data: {
        openid: wx.getStorageSync('openid'),
      },
      success: function (res) {
        console.log(res)
        that.setData({
          communityListOne: res.data
        })
      }
    })
  }
});